import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import {
  Constant_Enum_Enum_Scheduled_Type,
  Constant_Enum_Enum_Scheduled_Status,
  IConstant_Enum_Type_Scheduled_Enum_Type,
  IConstant_Enum_Type_Scheduled_Status,
} from '@/common/constants/enum';
import { ApiProperty } from '@nestjs/swagger';
import { IsNumber, IsNotEmpty, IsString, IsOptional } from 'class-validator';

export class Scheduled_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '调度名称' })
  scheduledName: string;

  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '类型', enum: Constant_Enum_Enum_Scheduled_Type })
  scheduleddType: IConstant_Enum_Type_Scheduled_Enum_Type;

  @IsString()
  @IsOptional()
  @ApiProperty({
    description: '状态',
    enum: Constant_Enum_Enum_Scheduled_Status,
  })
  status?: IConstant_Enum_Type_Scheduled_Status;

  @IsNumber()
  @IsOptional()
  @ApiProperty({ type: 'bigint', description: '完成时间' })
  scheduledd_at?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '详情信息' })
  scheduleddDetail?: string;
}

export class Scheduled_Update_Dto extends PartialType(Scheduled_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}
